﻿/// Copyright © 2013 Microsoft Corporation. 
/// This project is released under the Microsoft Public License (MS-PL)
///
namespace DataMorph.Common.Storage
{
    using Microsoft.WindowsAzure.Storage;
    using Microsoft.WindowsAzure.Storage.Auth;
    using Microsoft.WindowsAzure.Storage.Blob;
    using Microsoft.WindowsAzure.Storage.Queue;
    using Microsoft.WindowsAzure.Storage.Table;

    public class CloudStorageAccountWrapper : ICloudStorageAccount
    {
        private readonly CloudStorageAccount cloudStorageAccount;

        public CloudStorageAccountWrapper(CloudStorageAccount cloudStorageAccount)
        {
            this.cloudStorageAccount = cloudStorageAccount;
        }

        public CloudStorageAccountWrapper(string name, string key)
        {
            this.cloudStorageAccount = new CloudStorageAccount(new StorageCredentials(name, key), false);
        }

        public string GetName()
        {
            return this.cloudStorageAccount.Credentials.AccountName;
        }

        public CloudBlobClient CreateCloudBlobClient()
        {
            return this.cloudStorageAccount.CreateCloudBlobClient();
        }

        public CloudQueueClient CreateCloudQueueClient()
        {
            return this.cloudStorageAccount.CreateCloudQueueClient();
        }

        public CloudTableClient CreateCloudTableClient()
        {
            return this.cloudStorageAccount.CreateCloudTableClient();
        }
    }
}